<?php
		mysql_data_seek($forms_info, 0);
		/*echo "<pre>";
			print_r($forms_info);
		echo "</pre>";*/
		//$pup_only = $forms_info ;
		/*while($crap = sqlFetchArray($pup_only)){
			echo "<pre>";
			print_r($crap);
		echo "</pre>";
		}*/
		
		$date_row = '';
		$scheduled = '';
		$pup1 = '';
		$pup2 = '';
		$pup3 = '';
		$pup4 = '';
		$pup5 = '';
		
		
		
		function create_pupi($value){
			global $date_row, $scheduled, $pup1, $pup2, $pup3, $pup4, $pup5, $forms_info;
			$date_row =  "<td>". xl('New') ."<input type='text' id='1_date_1' name='1_date_1' hidden></input></td>";
			$scheduled = "<td><select type='text' id='1_scheduled_1' name='1_scheduled_1'>".
					"	<option value='1' text='". xl('Day 1-2')."'  >".
							xl('Day 1-2').
					"	</option>".
					"	<option value='2' text=' ".xl('Wk 1')."' >".
							xl('Wk 1') .
					"	</option>".
					"	<option value='3' text=' ".xl('Mo 1')." '>".
							xl('Mo 1') .
					"	</option>".
					"	<option value='4' text='". xl('Mo 3') ."'>".
							xl('Mo 3') .
					"	</option>".
					"	<option value='5' text='". xl('Mo 6')."'>".
							xl('Mo 6') .
					"	</option>".
					"	<option value='6' text='". xl('Mo 9')."'>".
							xl('Mo 9') .
					"	</option>".
					"	<option value='7' text='". xl('Mo 12')."'>".
							xl('Mo 12') .
					"	</option>".
					"	<option value='8' text='". xl('Mo 24')."'>".
							xl('Mo 24') .
					"	</option>".
					"	<option value='9' text='". xl('Unscheduled')."'>".
							xl('Unscheduled').
					"	</option>".
					"</select></td>";
			$pup1 = "<td><input type='text' id='1_pupillometry_1' name='1_pupillometry_1'>mm</input></td>";
			$pup2 = "<td><input type='text' id='1_pupillometry_2' name='1_pupillometry_2'>mm</input></td>";
			$pup3 = "<td><select type='text' id='1_pupillometry_3' name='1_pupillometry_3'>".
					"	<option value='1' text='". xl('Normal')."'>".
							xl('Normal') .
					"	</option> " .
					"	<option value='2' text='". xl('Abnormal')."'>".
							xl('Abnormal') .
					"	</option>" .
					"</select></td>";
			$pup4 = "<td><select type='text' id='1_pupillometry_4' name='1_pupillometry_4'>".
					"	<option value='1' text='". xl('Round') ."'>".
							xl('Round') .
					"	</option>".
					"	<option value='2' text='". xl('Elliptical') ."'>".
							xl('Elliptical').
					"	</option>".
					"	<option value='3' text='". xl('Irregular') ."'>".
							xl('Irregular') .
					"	</option>".
					"</select></td>";
			$pup5 = "<td><select type='text' id='1_pupillometry_5' name='1_pupillometry_5'>".
					"	<option value='1' text='". xl('Center')."'>".
							 xl('Center') .
					"	</option>".
					"	<option value='2' text='". xl('Off Center') ."'>".
							xl('Off Center') .
					"	</option>".
					"</select></td>";
					
				$number = 2;
				while($row = sqlFetchArray($forms_info)){
					$date_row .=  "<td><input type='text' id='".$number."_date_1' name='".$number."_date_1' value ='".$row['date']."'></input></td>";
					$scheduled .= "<td><select type='text' id='".$number."_scheduled_1' name='".$number."_scheduled_1'>".
						"	<option value='1' text='". xl('Day 1-2')."' ". selected(1, $row['scheduled']) ." >".
								xl('Day 1-2').
						"	</option>".
						"	<option value='2' text=' ".xl('Wk 1')." ' ". selected(2, $row['scheduled']) .">".
								xl('Wk 1') .
						"	</option>".
						"	<option value='3' text=' ".xl('Mo 1')." ' ". selected(3, $row['scheduled']) .">".
								xl('Mo 1') .
						"	</option>".
						"	<option value='4' text='". xl('Mo 3') ."' ". selected(4, $row['scheduled']) .">".
								xl('Mo 3') .
						"	</option>".
						"	<option value='5' text='". xl('Mo 6')."' ". selected(5, $row['scheduled']) .">".
								xl('Mo 6') .
						"	</option>".
						"	<option value='6' text='". xl('Mo 9')."' ". selected(6, $row['scheduled']) .">".
								xl('Mo 9') .
						"	</option>".
						"	<option value='7' text='". xl('Mo 12')."' ". selected(7, $row['scheduled']) .">".
								xl('Mo 12') .
						"	</option>".
						"	<option value='8' text='". xl('Mo 24')."' ". selected(8, $row['scheduled']) .">".
								xl('Mo 24') .
						"	</option>".
						"	<option value='9' text='". xl('Unscheduled')."' ". selected(9, $row['scheduled']) .">".
								xl('Unscheduled').
						"	</option>".
						"</select></td>";
					$pup1 .= "<td><input type='text' id='".$number."_pupillometry_1' name='".$number."_pupillometry_1' value='".$row['pupil_size_minimum']."'>mm</input></td>";
					$pup2 .= "<td><input type='text' id='".$number."_pupillometry_2' name='".$number."_pupillometry_2' value='".$row['pupil_size_maximum']."'>mm</input></td>";
					$pup3 .= "<td><select type='text' id='".$number."_pupillometry_3' name='".$number."_pupillometry_3'>".
							"	<option value='1' text='". xl('Normal')."' ". selected(1, $row['pupil_reaction']) .">".
									xl('Normal') .
							"	</option> " .
							"	<option value='2' text='". xl('Abnormal')."' ". selected(2, $row['pupil_reaction']) .">".
									xl('Abnormal') .
							"	</option>" .
							"</select></td>";
					$pup4 .= "<td><select type='text' id='".$number."_pupillometry_4' name='".$number."_pupillometry_4'>".
							"	<option value='1' text='". xl('Round') ."' ". selected(1, $row['pupil_shape']) .">".
									xl('Round') .
							"	</option>".
							"	<option value='2' text='". xl('Elliptical') ."' ". selected(2, $row['pupil_shape']) .">".
									xl('Elliptical').
							"	</option>".
							"	<option value='3' text='". xl('Irregular') ."' ". selected(3, $row['pupil_shape']) .">".
									xl('Irregular') .
							"	</option>".
							"</select></td>";
					$pup5 .= "<td><select type='text' id='".$number."_pupillometry_5' name='".$number."_pupillometry_5'>".
							"	<option value='1' text='". xl('Center')."' ". selected(1, $row['pupil_location']) .">".
									 xl('Center') .
							"	</option>".
							"	<option value='2' text='". xl('Off Center') ."' ". selected(2, $row['pupil_location']) .">".
									xl('Off Center') .
							"	</option>".
							"</select></td>";
					$number += 1;
				}			
		}

		
		create_pupi(0);
?>

		<table class="vertical_table" id='t_pupillometry'>
            <caption><?php echo xl('Pupillometry (Treatment eye only)');?></caption>
            <thead>
				<tr>
                    <th colspan="3"><?php //echo xl('Date'); ?></th>
                </tr>
				<tr>
                    <th colspan="3"><?php echo xl('Schedule'); ?></th>
                </tr>	
                <tr>
                    <th colspan="3">1. <?php echo xl('Pupil Size Minimun'); ?>:</th>
                </tr>
				<tr>
                    <th colspan="3">2. <?php echo xl('Pupil Size Maximum'); ?>:</th>
                </tr>
				<tr>
                    <th colspan="3">3. <?php echo xl('Puil Reacion'); ?>:</th>
                </tr>
				<tr>
                    <th colspan="3">4. <?php echo xl('Pupil Shape'); ?>:</th>
                </tr>
				<tr>
                    <th colspan="3">5. <?php echo xl('Pupil Location'); ?>:</th>
                </tr>
            </thead>
            <tbody>
				<tr>
					<?php echo $date_row;?>
				</tr>
				<tr>
					<?php echo $scheduled;?>
				</tr>
				<tr>
					<?php echo $pup1;?>
				</tr>
				<tr>
					<?php echo $pup2;?>
				</tr>
				<tr>
					<?php echo $pup3;?>
				</tr>
				<tr>
					<?php echo $pup4;?>
				</tr>
				<tr>
					<?php echo $pup5;?>
				</tr>
				

            </tbody>
        </table>